Imports System 
Imports System.Text 
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Configuration 
Imports System.Xml 
Imports System.Xml.Serialization
Imports SubSonic 
Imports SubSonic.Utilities
Namespace Data
    ''' <summary>
    ''' Controller class for aspnet_WebEvent_Events
    ''' </summary>
		<System.ComponentModel.DataObject()> Public Partial Class AspnetWebEventEventsController
    
        ' Preload our schema..
        Dim thisSchemaLoad As AspnetWebEventEvents = New AspnetWebEventEvents()
        Private strUserName As String = String.Empty
        Protected ReadOnly Property UserName() As String
            Get
				If strUserName.Length = 0 Then
		        
    				If Not System.Web.HttpContext.Current Is Nothing Then
						strUserName = System.Web.HttpContext.Current.User.Identity.Name
					Else
		        		strUserName = System.Threading.Thread.CurrentPrincipal.Identity.Name
					End If
					Return strUserName
				End If
				Return strUserName
			End Get
        End Property
        <DataObjectMethod(DataObjectMethodType.Select, True)> Public Function FetchAll() As AspnetWebEventEventsCollection
        
            Dim coll As AspnetWebEventEventsCollection = New AspnetWebEventEventsCollection()
            Dim qry As Query = New Query(AspnetWebEventEvents.Schema)
            coll.LoadAndCloseReader(qry.ExecuteReader())
            Return coll
            
        End Function
        <DataObjectMethod(DataObjectMethodType.Select, True)> Public Function FetchByID(ByVal EventId As Object) As AspnetWebEventEventsCollection 
        
            Dim coll As AspnetWebEventEventsCollection = New AspnetWebEventEventsCollection().Where("EventId", EventId).Load()
            Return coll
        
        End Function
        
        <DataObjectMethod(DataObjectMethodType.Select, True)> Public Function FetchByQuery(ByVal qry As SubSonic.Query) As AspnetWebEventEventsCollection 
        
            Dim coll As AspnetWebEventEventsCollection = New AspnetWebEventEventsCollection()
            coll.LoadAndCloseReader(qry.ExecuteReader())
            Return coll
        
        End Function
        <DataObjectMethod(DataObjectMethodType.Delete, True)> Public Function Delete(ByVal EventId As Object) as Boolean
        
            Return (AspnetWebEventEvents.Delete(EventId) = 1)
        
        End Function
        <DataObjectMethod(DataObjectMethodType.Delete, False)> Public Function Destroy(ByVal EventId As Object) as Boolean
        
            Return (AspnetWebEventEvents.Destroy(EventId) = 1)
        
        End Function
        
    	
	    ''' <summary>
	    ''' Inserts a record, can be used with the Object Data Source
	    ''' </summary>
        <DataObjectMethod(DataObjectMethodType.Insert, True)> Public Sub Insert(ByVal EventId As String,ByVal EventTimeUtc As DateTime,ByVal EventTime As DateTime,ByVal EventType As String,ByVal EventSequence As Decimal,ByVal EventOccurrence As Decimal,ByVal EventCode As Integer,ByVal EventDetailCode As Integer,ByVal Message As String,ByVal ApplicationPath As String,ByVal ApplicationVirtualPath As String,ByVal MachineName As String,ByVal RequestUrl As String,ByVal ExceptionType As String,ByVal Details As String)
	   
		    Dim item As AspnetWebEventEvents = New AspnetWebEventEvents()
		    
            item.EventId = EventId
            
            item.EventTimeUtc = EventTimeUtc
            
            item.EventTime = EventTime
            
            item.EventType = EventType
            
            item.EventSequence = EventSequence
            
            item.EventOccurrence = EventOccurrence
            
            item.EventCode = EventCode
            
            item.EventDetailCode = EventDetailCode
            
            item.Message = Message
            
            item.ApplicationPath = ApplicationPath
            
            item.ApplicationVirtualPath = ApplicationVirtualPath
            
            item.MachineName = MachineName
            
            item.RequestUrl = RequestUrl
            
            item.ExceptionType = ExceptionType
            
            item.Details = Details
            
	    
		    item.Save(UserName)
	   
	   End Sub
    	
	    ''' <summary>
	    ''' Updates a record, can be used with the Object Data Source
	    ''' </summary>
        <DataObjectMethod(DataObjectMethodType.Update, True)> Public Sub Update(ByVal EventId As String,ByVal EventTimeUtc As DateTime,ByVal EventTime As DateTime,ByVal EventType As String,ByVal EventSequence As Decimal,ByVal EventOccurrence As Decimal,ByVal EventCode As Integer,ByVal EventDetailCode As Integer,ByVal Message As String,ByVal ApplicationPath As String,ByVal ApplicationVirtualPath As String,ByVal MachineName As String,ByVal RequestUrl As String,ByVal ExceptionType As String,ByVal Details As String)
	    
		    Dim item As AspnetWebEventEvents = New AspnetWebEventEvents()
		    
				item.EventId = EventId
				
				item.EventTimeUtc = EventTimeUtc
				
				item.EventTime = EventTime
				
				item.EventType = EventType
				
				item.EventSequence = EventSequence
				
				item.EventOccurrence = EventOccurrence
				
				item.EventCode = EventCode
				
				item.EventDetailCode = EventDetailCode
				
				item.Message = Message
				
				item.ApplicationPath = ApplicationPath
				
				item.ApplicationVirtualPath = ApplicationVirtualPath
				
				item.MachineName = MachineName
				
				item.RequestUrl = RequestUrl
				
				item.ExceptionType = ExceptionType
				
				item.Details = Details
				
		    item.MarkOld()
		    item.Save(UserName)
	    
	    End Sub
    End Class
End Namespace
